//
//  SQLabel.m
//  IM
//
//  Created by WTTT on 2023/2/6.
//

#import "SQLabel.h"
#import <UIKit/UIKit.h>
@interface SQLabel()

@end

@implementation SQLabel

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.edgeInsets = UIEdgeInsetsMake(2, 5, 2, 5);
    }
    return  self;
}
- (instancetype)initWithCoder:(NSCoder *)coder{
    if (self = [super initWithCoder:coder]) {
        self.edgeInsets = UIEdgeInsetsMake(2, 5, 2, 5);
    }
    return  self;
}
- (void)awakeFromNib{
    [super awakeFromNib];
    self.edgeInsets = UIEdgeInsetsMake(2, 5, 2, 5);
}
-(CGRect)textRectForBounds:(CGRect)bounds limitedToNumberOfLines:(NSInteger)numberOfLines{
    CGRect rect = [super textRectForBounds:UIEdgeInsetsInsetRect(bounds, self.edgeInsets) limitedToNumberOfLines:numberOfLines];
    rect.origin.x -= self.edgeInsets.left;
    rect.origin.y -= self.edgeInsets.top;
    rect.size.width += self.edgeInsets.left + self.edgeInsets.right;
    rect.size.height += self.edgeInsets.top + self.edgeInsets.bottom;
    return  rect;
}
- (void)drawTextInRect:(CGRect)rect{
    [super drawTextInRect:UIEdgeInsetsInsetRect(rect, self.edgeInsets)];
}
@end
